package com.cy.service;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.cy.condition.BackUserCondition;
import com.cy.entity.BackPurview;
import com.cy.entity.BackRole;
import com.cy.entity.BackUser;
import com.cy.entity.BackUserRole;

@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public interface BackUserService<T> extends BaseService<T> {

	
	/**
	 *	编辑后台用户
	 */
	public BackUser editBackUserDWR(BackUser backUser,Long id);
	/**
	 *	保存后台用户
	 */
	public BackUser saveBackUser(BackUser backUser);
	
	/**
	 *	根据帐号查询后台用户
	 */
	public BackUser findBackUserByLoginName(String loginName);
	
	/**
	 * 根据帐号用户名和密码查询后台用户
	 */
	public BackUser findBackUserByLoginNameAndPassWord(String loginName,String password);
	
	/**
	 * 用户后台登录
	 */
	public Boolean loginIndex(BackUser backUser);
	
	/**
	 * 根据condition查询后台用户集合
	 */
	public List<BackUser> listBackUserByCondition(int firstResult, int maxResults, BackUserCondition condition);
	/**
	 * 根据condition查询后台用户集合数量
	 */
	public int countBackUserByCondition(BackUserCondition condition);
	/**
	 * 关联用户和角色
	 */
	public void ralationBackUserAndRole(Long userId,String roleStr);
	
	/**
	 * 通过后台用户查询对应的角色
	 */
	public List<BackRole> listBackRoleByBackUser(BackUser backUser);
	
	/**
	 * 批量更新用户角色中间表
	 */
	public void updateRoleRelationBackUsers(BackRole backRole,String backUserStr);
	
	/**
	 * 通过后台用户查询对应的所有权限 （顺序）
	 */
	public List<BackPurview> listBackUserAllPurview(Long id);
}
